<template>
  <div class="component-nav">
    <div class="nav">
      <slot></slot>
    </div>
    <div class="left">
      <slot name="left">
        <md-icon name="arrow-left" size="lg" @click="back"></md-icon>
      </slot>
    </div>
    <div class="right">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

const back = () => {
  router.back()
}
</script>

<style lang="scss" scoped>
  .component-nav{
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 99;
    color: #fff;

    .nav{
      padding: 20px;
      text-align: center;
      line-height: 30px;
      font-size: 16px; 
    }

    .left{
      position: absolute;
      top: 20px;
      left: 20px;
      line-height: 30px;
    }

    .right{
      position: absolute;
      top: 20px;
      right: 20px;
      line-height: 30px;
    }
  }
</style>